<%--***************************************
*
*云网支付
* 
***************************************--%>
<%@ page import="
	java.util.*,
	java.text.*,
	com.probiz.estore.system.util.TranslateService,
	com.probiz.estore.common.model.order.SalesOrder,
	com.probiz.estore.common.model.system.PaymentGateway,
	com.probiz.estore.common.helper.ConfigUtil"
	contentType="text/html; charset=UTF-8"%>
	
<%
	response.setCharacterEncoding("gb2312");
	SalesOrder salesOrder = (SalesOrder) request.getAttribute("salesOrder");
	PaymentGateway paymentGateway = (PaymentGateway) request.getAttribute("paymentGateway");
	request.setAttribute("paymentGateway",paymentGateway);
	HashMap paramMap = paymentGateway.getConfigData();

	//-----------------------start: 账户信息------------------------------------------
	String c_mid ="";
	String c_pass="";
	String c_moneytype="";
	String c_language="";
	String type="";
	if (paramMap != null) {
		c_mid = paramMap.get("c_mid").toString().trim(); 					//商户号 
		c_pass = paramMap.get("c_pass").toString().trim(); 					//密钥
		c_moneytype = paramMap.get("c_moneytype").toString().trim(); 		//币种
		c_language = paramMap.get("c_language").toString().trim(); 			//中英文界面
		type = paramMap.get("type").toString().trim(); 						//接入模式
	}
	//-----------------------end:   账户信息------------------------------------------
	
	//-----------------------start: 配置信息------------------------------------------
	String returnUrl = ConfigUtil.getInstance().getStoreFrontSiteUrl()+ "/system/payment/cncard_response.html";
	
	//-----------------------end:   配置信息------------------------------------------
	
	//-----------------------start: 业务信息------------------------------------------
	DecimalFormat df= new DecimalFormat("0.00");
	SimpleDateFormat sdf= new SimpleDateFormat("yyyyMMdd");
	String amount = df.format(salesOrder.getUnPaidAmount());			//支付金额
	String createTime = sdf.format(salesOrder.getCreateTime());			//下单时间
	String orderNo = salesOrder.getOrderNo();	//订单号
	String notifytype = "0"; //0普通通知方式1服务器通知方式，空值为普通通知方式
	String c_retflag = "1"; //0－不用返回	1－返回到c_returl对应的URL
	String c_paygate = "0"; //支付方式
	
	//c_signstr=MD5(c_mid & c_order & c_orderamount & c_ymd & c_moneytype & c_retflag & c_returl & c_paygate & c_memo1 & c_memo2 &notifytype & c_language & c_pass)
	StringBuffer originalText = new StringBuffer();
	originalText.append(c_mid).append(orderNo).append(amount).append(createTime).append(c_moneytype).append(c_retflag).
				append(returnUrl).append(c_paygate).append(notifytype).append(c_language).append(c_pass);
	String c_signstr = TranslateService.md5Translate(originalText.toString());
	String requestUrl="";			//提交地址
	if(type.equals("1")){
		requestUrl="https://www.cncard.net/purchase/getorder.asp";
	}else{
		requestUrl="https://www.cncard.net/testport/port_test11.asp";		
	}
	//-----------------------end:	业务信息------------------------------------------
%>
	
<div style="display:none;">
	<form name="paymentGatewayForm" method="post" action="<%=requestUrl%>">
		<input type="hidden" name="c_mid" value="<%=c_mid%>">   
		<input type="hidden" name="c_order" value="<%=orderNo%>">	   
		<input type="hidden" name="c_name" value="${salesOrder.customerFullName}">   
		<input type="hidden" name="c_address" value="${salesOrder.orderAddress.address1}">   
		<input type="hidden" name="c_tel" value="${salesOrder.orderAddress.phoneNumber}">   
		<input type="hidden" name="c_post" value="${salesOrder.orderAddress.postalcode}">   
		<input type="hidden" name="c_email" value="${salesOrder.customerEmail}">
		<input type="hidden" name="c_orderamount" value="<%=amount%>">   
		<input type="hidden" name="c_ymd" value="<%=createTime%>">   
		<input type="hidden" name="c_moneytype" value="<%=c_moneytype%>">   
		<input type="hidden" name="c_retflag" value="<%=c_retflag%>">  
		<input type="hidden" name="c_returl" value="<%=returnUrl%>">
		<input type="hidden" name="c_paygate" value="0">
		<input type="hidden" name="c_memo1" value="">
		<input type="hidden" name="c_memo2" value="">
		<input type="hidden" name="c_language" value="<%=c_language%>">
		<input type="hidden" name="notifytype" value="<%=notifytype%>">
		<input type="hidden" name="c_signstr" value="<%=c_signstr%>">
    </form> 
</div>	

<script type="text/javascript">
$j(document).ready(function () {
	document.forms["paymentGatewayForm"].submit();
});
</script>
<%@ include file="./include/payOrderTips.jspf" %>